from django.contrib import admin
from django.utils.safestring import mark_safe

from api.models import user,sig_user_task,sig_user_jl
# Register your models here.

class userAdmin(admin.ModelAdmin):
    def img(self, obj):  # imageField显示方法设置,图片路径设为显示图片
        return mark_safe('<img src="%s" height="40" />' % obj.avatarUrl)
    list_display = ('id','OpenID', 'session_key','nickName','img','gender','country','province','city','language','jifen','token')

class sig_user_task_Admin(admin.ModelAdmin):
    def img(self,obj):
        return mark_safe('<img src="%s" height="100" />'% obj.img_url)
    list_display = ('id','name','img','task_jifen','task_start_date','task_end_date','sig_text','xianshi','XunHuan')


class sig_user_jl_Admin(admin.ModelAdmin):
    list_display = ('id', 'sig_user_id', 'sig_id', 'Zhuang_tai','time','chuang_jian_shijian','jieshu_shijian')

admin.site.register(user,userAdmin)
admin.site.register(sig_user_task,sig_user_task_Admin)
admin.site.register(sig_user_jl,sig_user_jl_Admin)